home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
301-325
/
disk_319
/
cnewssrc
/
cnews.src.lzh
/
libamiga
/
fopenexcl.c
< prev
next >
Wrap
C/C++ Source or Header
|
1980-01-01
|
403b
|
23 lines
/*
* fopenexcl(name) - fopen(name, "w") with error and errno==EEXIST,
* if name exists (V7/V8/V9)
*/
#include <stdio.h>
#include <errno.h>
#define F_OK 0
extern int errno;
FILE *
fopenexcl(name)
register char *name;
{
if (access(name, F_OK) >= 0) { /* name exists */
errno = EEXIST;
return NULL; /* refuse to write on name */
} else
return fopen(name, "w"); /* try to create name */
}